Environment prediction using reinforcement learning

ABSTRACT

Methods, systems, and apparatus, including computer programs encoded on a computer storage medium, for prediction of an outcome related to an environment. In one aspect, a system comprises a state representation neural network that is configured to: receive an observation characterizing a state of an environment being interacted with by an agent and process the observation to generate an internal state representation of the environment state; a prediction neural network that is configured to receive a current internal state representation of a current environment state and process the current internal state representation to generate a predicted subsequent state representation of a subsequent state of the environment and a predicted reward for the subsequent state; and a value prediction neural network that is configured to receive a current internal state representation of a current environment state and process the current internal state representation to generate a value prediction.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation application of, and claims priority to, PCT Patent Application No. PCT/IB2017/056902, filed on Nov. 4, 2017, which application claims the benefit under 35 U.S.C. § 119(e) of U.S. Patent Application No. 62/418,159, filed Nov. 4, 2016. The disclosure of each of the foregoing applications is incorporated herein by reference.

BACKGROUND

This specification relates to prediction using a machine learning model.

Machine learning models receive an input and generate an output, e.g., a predicted output, based on the received input. Some machine learning models are parametric models and generate the output based on the received input and on values of the parameters of the model.

Some machine learning models are deep models that employ multiple layers of models to generate an output for a received input. For example, a deep neural network is a deep machine learning model that includes an output layer and one or more hidden layers that each apply a non-linear transformation to a received input to generate an output.

SUMMARY

This specification describes a system implemented as computer programs on one or more computers in one or more locations that determines an estimate of an aggregate reward resulting from an environment being in an initial state by generating value predictions over a series of internal planning steps.

According to a first aspect there is provided a system comprising: a state representation neural network that is configured to: receive one or more observations characterizing states of an environment being interacted with by an agent, and process the one or more observations to generate an internal state representation of a current environment state; a prediction neural network that is configured to, for each of a plurality of internal time steps: receive an internal state representation for the internal time step; and process the internal state representation for the internal time step to generate: an internal state representation for a next internal time step, and a predicted reward for the next internal time step; a value prediction neural network that is configured to, for each of the plurality of internal time steps: receive the internal state representation for the internal time step, and process the internal state representation for the internal time step to generate a value prediction that is an estimate of a future cumulative discounted reward from a next internal time step onwards; and a predictron subsystem that is configured to: receive one or more observations characterizing states of the environment; provide the one or more observations as input to the state representation neural network to generate an internal state representation of the current environment state; for each of the plurality of internal time steps: generate, using the prediction neural network and the value prediction neural network and from the internal state representation for the internal time step: an internal state representation for the next internal time step, a predicted reward for the next internal time step, and a value prediction; and determine an aggregate reward from the predicted rewards and the value predictions for the internal time steps.

In a related aspect there is provided system implemented by one or more computers, the system comprising: a state representation neural network that is configured to: receive an observation characterizing a state of an environment being interacted with by an agent, and process the observation to generate an internal state representation of the environment state; a prediction neural network that is configured to: receive a current internal state representation of a current environment state; and process the current internal state representation to generate: a predicted subsequent state representation of a subsequent state of the environment, and a predicted reward for the subsequent state; and a value prediction neural network that is configured to: receive a current internal state representation of a current environment state, and process the current internal state representation to generate a value prediction that is an estimate of a future cumulative discounted reward from the current environment state onwards.

In a preferred implementation of the related aspect, the system includes a predictron subsystem that is configured to: receive an initial observation characterizing an initial state of the environment; provide the initial observation as input to the state representation neural network to generate an initial internal state representation of the environment state; for each of a plurality of internal time steps: generate, using the prediction neural network and the value prediction neural network and from a current state representation, a predicted subsequent state representation, a predicted reward, and a value prediction; and determine an aggregate reward from the predicted rewards and the value predictions for the time steps

Thus as described herein the system may integrate a model of the environment with a planning model. This is here termed predictron system; in some implementations the predictron system employs a predictron sub-system as described above. The predictron subsystem may be further configured to provide the aggregate reward as an estimate of a reward resulting from the environment being in the current state. The internal time steps may be considered as planning steps. The future cumulative discounted reward may comprise an estimate of a future reward for a plurality of future time steps, and thus it may be cumulative. A reward may be discounted by giving the rewards weights and weighting a reward at a later time step less than a reward at an earlier time step.

In some implementations, the prediction neural network is further configured to generate a predicted discount factor for the next internal time step, and the predictron subsystem is configured to use the predicted discount factors for the internal time steps in determining the aggregate reward. A reward may be discounted by weighting a future reward by a product of discount factors, each between 0 and 1, one for each successive time step. The predictron subsystem may be used to predict the discount factors. The aggregate reward may be determined by an accumulator, as described later.

In some implementations, the system further comprises: a lambda neural network that is configured to, for each of the internal time steps, process an internal state representation for a current internal time step to generate a lambda factor for a next internal time step, and the predictron subsystem is configured to determine return factors for the internal time steps and use the lambda factors to determine weights for the return factors in determining the aggregate reward. A return factor may comprise a predicted return for an internal planning time step. This may be determined from a combination of the predicted reward, predicted discount factor, and value prediction; it may be determined for each of k future internal time i.e. planning steps.

In some implementations, the state representation neural network is a recurrent neural network.

In some implementations, the state representation neural network is a feedforward neural network.

In some implementations, the prediction neural network is a recurrent neural network.

In some implementations, the prediction neural network is a feedforward neural network that has different parameter values at each of the plurality of time steps.

According to a second aspect, there is provided a method comprising the respective operations performed by the predictron subsystem.

According to a third aspect, there is provided a method of training the system comprising: determining a gradient of a loss that is based on the aggregate reward and an estimate of a reward resulting from the environment being in the current state; and backpropagating the gradient of the loss to update current values of parameters of the state representation neural network, the prediction neural network, the value prediction neural network, and the lambda neural network.

According to a fourth aspect, there is provided a method for training the system comprising: determining a gradient of a consistency loss that is based on consistency of the return factors determined by the predictron subsystem for the internal time steps; and backpropagating the gradient of the consistency loss to update current values of parameters of the state representation neural network, the prediction neural network, the value prediction neural network, and the lambda neural network.

Particular embodiments of the subject matter described in this specification can be implemented so as to realize one or more of the following advantages. A predictron system as described in this specification jointly learns a model of the environment (i.e. the state representation neural network and the prediction neural network of the system) and a planning model (i.e. the value prediction neural network and, where employed, the lambda neural network), where the planning model generates a value function that estimates cumulative reward. Conventional systems separately learn the model of the environment and the planning model, and therefore in conventional systems the model is not well-matched to the planning task. In contrast, for the predictron system described in this specification, the environment model and the planning model are jointly learned, and the system is therefore able to generate value functions that contribute to estimating the outcome associated with the current state of the environment more accurately than conventional systems.

Moreover, unlike conventional systems, the predictron system as described in this specification can be trained in part by unsupervised learning methods, i.e. based on observations characterizing states of an environment where the outcome associated with the current state of the environment is not known. Therefore, due to auxiliary unsupervised training, the system as described in this specification generates value functions that contribute to estimating the outcome associated with the current state of the environment more accurately than conventional systems. Furthermore, less labelled training data is required for training the predictron system as described in this specification than is required for training conventional systems since, unlike conventional systems, the predictron system can be trained by auxiliary unsupervised training.

Furthermore, the predictron system as described in this specification generates an output based on an adaptive number of planning steps depending on the internal state representation and internal dynamics of the system. In particular, in some cases, the predictron system may generate an output based on fewer planning steps than the total possible number of planning steps, and therefore consume fewer computational resources (e.g., using less computing power and computing time) than conventional systems that generate outputs based on utilizing every planning step in all cases.

The details of one or more embodiments of the subject matter of this specification are set forth in the accompanying drawings and the description below. Other features, aspects, and advantages of the subject matter will become apparent from the description, the drawings, and the claims.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 shows an example predictron system.

FIG. 2 is a flow diagram of an example process for determining an aggregate reward output.

FIG. 3 is a flow diagram of an example process for training of a predictron system.

Like reference numbers and designations in the various drawings indicate like elements.

DETAILED DESCRIPTION

FIG. 1 shows an example predictron system 100. The predictron system 100 is an example of a system implemented as computer programs on one or more computers in one or more locations in which the systems, components, and techniques described below are implemented.

The system 100 estimates the effects of actions 104 performed by an agent 102 interacting with an environment 106.

In some implementations, the environment 106 is a simulated environment and the agent 102 is implemented as one or more computer programs interacting with the simulated environment. For example, the simulated environment may be a video game and the agent 102 may be a simulated user playing the video game. As another example, the simulated environment may be a motion simulation environment, e.g., a driving simulation or a flight simulation, and the agent 102 is a simulated vehicle navigating through the motion simulation.

In some other implementations, the environment 106 is a real-world environment and the agent 102 is a mechanical agent interacting with the real-world environment. For example, the agent 102 may be a robot interacting with the environment to accomplish a specific task. As another example, the agent 102 may be an autonomous or semi-autonomous vehicle navigating through the environment 106.

The system 100 outputs an aggregate reward 110 as an estimate of an outcome 128 associated with a current state of an environment 106 being interacted with by an agent 102. The system 100 generates the aggregate reward 110 by accumulating predicted rewards 116, predicted discount factors 118, and value predictions over multiple internal time steps, referred to in this specification as planning steps.

The outcome 128 can encode any event or aspect of the environment 106 being interacted with by the agent 102. For example, the outcome 128 may include binary values indicating whether an agent navigating in an environment reaches particular locations in the environment starting from a current state of the environment 106. As another example, the outcome 128 may include values indicating a cumulative reward received by an agent 102 navigating in an environment 106 based on the agent 102 accomplishing certain tasks, e.g. reaching certain locations in the environment 106, starting from a current state of the environment 106.

Once trained, the system 100 can be used, for example, to select actions 104 to be performed by the agent 102. For example, if the outcome 128 includes a value rating the success of the interaction of the agent 102 with the environment 106, e.g. a value representing the amount of time it takes for the agent to accomplish a task starting from a current state of the environment, then the action 104 of the agent 102 may be selected as an action that that is predicted by the system 100 to optimize the component of the outcome 128 corresponding to the value.

The system 100 includes a prediction neural network 120 that, for each planning step, is configured to process an input to generate as output: (i) an internal state representation 114 for the next planning step, i.e. the planning step following the current planning step (ii) a predicted reward 116 for the next planning step, and (iii) a predicted discount factor 118 for the next planning step. For the first planning step, the prediction neural network 120 receives as input the internal state representation 114 generated by a state representation neural network 122, and for subsequent planning steps, the prediction neural network 120 receives as input the internal state representation 114 generated by the prediction neural network 120 at the previous planning step. The predicted reward 116, the predicted discount factor 118, and the outcome 128 can be scalars, vectors, or matrices, and in general all have the same dimensionality. Generally the entries of the predicted discount factor 118 are all values between 0 and 1. The internal state representation 114, the predicted reward 116, and the predicted discount factor 118 are abstract representations used by the system to facilitate prediction of the outcome 128 associated with the current state of the environment 106.

The state representation neural network 122 is configured to receive as input a sequence of one or more observations 108 of the environment 106 and to process the observations in accordance with the values of a set of state representation neural network parameters to generate as output the internal state representation 114 for the first planning step. In general, the dimensionality of the internal state representation 114 may be different from the dimensionality of the one or more observations 108 of the environment 106.

In some implementations, the observations 108 may be generated by or derived from sensors of the agent 102. For example, the observation 108 may be images captured by a camera of the agent 102. As another example, the observations 108 may be derived from data captured from a laser sensor of the agent 102. As another example, the observations 108 may be hyperspectral images captured by a hyperspectral sensor of the agent 102.

The system 100 includes a value prediction neural network 124 that, for each planning step, is configured to process the internal state representation 114 for the planning step to generate a value prediction for the next planning step. The value prediction for a planning step is an estimate of the future cumulative discounted reward from the next planning step onwards, i.e. the value prediction can be an estimate, rather than a direct computation, of the following sum:

k=r _(k+1)+γ_(k+1) r _(k+2)γ_(k+1)γ_(k+2) r _(k+3)+

where ν_(k) is the value prediction at planning step k, r_(i) is the predicted reward 116 at planning step i, and γ_(i) is the predicted factor 118 at planning step i.

The aggregate reward 110 is generated by the accumulator 112, and is an estimate of the outcome 128 associated with the current state of the environment 106. The aggregate reward 110 can be a scalar, vector, or matrix, and has the same dimensionality as the outcome 128. In some implementations, the accumulator 112 generates the aggregate reward 110 by a process referred to in this specification as k-step prediction, where k is an integer between 1 and K, and K is the total number of planning steps. In these implementations, the accumulator 112 generates the aggregate reward 110 by combining the predicted reward 116 and the predicted discount factor 118 for each of the first k planning steps, and the value prediction of the k-th planning step, to determine an output referred to in this specification as the k-step return. For k-step prediction, generally the aggregate reward 110 is determined as the k-step prediction corresponding to the final planning step K. In some implementations, the accumulator 112 generates the aggregate reward 110 by a process referred to in this specification as λ-weighted prediction. In these implementations, the system 100 includes a lambda neural network 126, that is configured to, for each of the planning steps, process the internal state representation 114 to generate a lambda factor for the planning step, where the lambda factor can be a scalar, vector, or matrix, and generally has the same dimensionality as the outcome 128. In some cases, the entries of the lambda factor are all values between 0 and 1. In these implementations, the accumulator 112 generates the aggregate reward 110 by determining the k-step return for each planning step k and combining them according to weights defined by the lambda factors to determine an output referred to in this specification as the λ-weighted return. Determining an aggregate reward output is further described with reference to FIG. 2.

The system 100 is trained by a training engine 130 based on a set of training data including observations 108 and corresponding outcomes 128. In particular, the training engine 130 backpropagates gradients determined based on a loss function, for example by stochastic gradient descent, to jointly optimize the values of the sets of parameters of the value prediction neural network 124, the state representation neural network 122, the prediction neural network 120, and in λ-weighted prediction implementations, the lambda neural network 126. Training the system 100 involves supervised training, and in some cases, auxiliary unsupervised training.

In supervised training of the system 100, the loss function depends on the outcome 128 corresponding to the observations 108 provided as input and processed by the system 100. For example, in the k-step prediction implementation, the supervised loss function may measure a difference between the outcome 128 and the k-step return generated by the accumulator 112. As another example, in the λ-weighted prediction implementation, the supervised loss function may measure a difference between the outcome 128 and the λ-weighted return generated by the accumulator 112.

In unsupervised training of the system 100, the loss function does not depend on the outcome 128 corresponding to the observations 108 provided as input and processed by the system 100. For example, in the λ-weighted prediction implementation, the unsupervised loss function may be a consistency loss function measuring a difference between each k-step return and the λ-weighted return. In this case, unsupervised training jointly adjusts the values of the parameters of the neural networks of the system 100 to decrease a difference between individual k-step returns and the λ-weighted return, making the k-step returns self-consistent and thereby increasing the robustness of the system 100. Training of the system 100 by the training engine 130 is further described with reference to FIG. 3.

Data structures referred to in this specification such as matrices and vectors, e.g. the outputs of any of the neural networks of the system 100, can be represented in any format that allows the data structures to be used in the manner described in the specification (e.g. an output of a neural network described as a matrix may be represented as a vector of the entries of the matrix).

FIG. 2 is a flow diagram of an example process 200 for determining an aggregate reward output. For convenience, the process 200 will be described as being performed by a system of one or more computers located in one or more locations. For example, a predictron system, e.g., the predictron system 100 of FIG. 1, appropriately programmed in accordance with this specification, can perform the process 200.

The system receives one or more observations of an environment being interacted with by an agent (step 202).

In some implementations, the environment is a simulated environment and the agent is implemented as one or more computer programs interacting with the simulated environment. For example, the simulated environment may be a video game and the agent may be a simulated user playing the video game. As another example, the simulated environment may be a motion simulation environment, e.g., a driving simulation or a flight simulation, and the agent is a simulated vehicle navigating through the motion simulation.

In some other implementations, the environment is a real-world environment and the agent is a mechanical agent interacting with the real-world environment. For example, the agent may be a robot interacting with the environment to accomplish a specific task. As another example, the agent may be an autonomous or semi-autonomous vehicle navigating through the environment.

In some implementations, the observations may be generated by or derived from sensors of the agent. For example, the observation may be images captured by a camera of the agent. As another example, the observations may be derived from data captured from a laser sensor of the agent. As another example, the observations may be hyperspectral images captured by a hyperspectral sensor of the agent.

The state representation neural network receives the one or more observations of the environment as input, and process the input in accordance with the values of the set of state representation neural network parameters, to generate as output an internal state representation for the first planning step (step 204).

In some implementations, the state representation neural network is a recurrent neural network, and the output of the state representation neural network is the output of the recurrent neural network after sequentially processing each of the observations. In some other implementations, the state representation neural network is a feedforward neural network, and the output of the state representation neural network is the output of the final layer of the feedforward neural network. In implementations where the state representation neural network is a feedforward neural network, the system may concatenate the one or more observations prior to providing them as input to the state representation neural network 122.

For each planning step, the prediction neural network processes an input to generate as output: (i) an internal state representation for the next planning step (ii) a predicted reward for the next planning step, and (iii) a predicted discount factor for the next planning step (step 206). For the first planning step, the prediction neural network receives as input the internal state representation generated by the state representation neural network, and for subsequent planning steps, the prediction neural network receives as input the internal state representation generated by the prediction neural network at the previous planning step. The predicted reward and predicted discount factor may be scalars, vectors, or matrices, and generally have the same dimension as the outcome. Generally the entries of the discount factor are all values between 0 and 1. The internal state representation for a planning step is an abstract representation of the environment used by the system to facilitate prediction of the outcome.

In some implementations, the prediction neural network is a recurrent neural network. In some other implementations, for the prediction neural network is a feedforward neural network that has different parameter values corresponding to each of the planning steps. In some implementations, the prediction neural network includes a sigmoid non-linearity layer to cause the values of the entries of the discount factor to lie in the range 0 to 1.

For each planning step, the value prediction neural network process an input to generate a value prediction for the next planning step (step 208). For the first planning step, the value prediction neural network receives as input the internal state representation generated by the state representation neural network, and for subsequent planning steps, the value prediction neural network receives as input the internal state representation generated by the prediction neural network at the previous planning step. The value prediction for a planning step is an estimate of the future cumulative discounted reward from the next internal time step onwards.

In some implementations, the value prediction neural network shares parameter values with the prediction neural network, i.e. the value prediction neural network receives as input an intermediate output of the prediction neural network generated as a result of processing an internal state representation. An intermediate output of the prediction neural network refers to activations of one or more units of one or more hidden layers of the prediction neural network.

In implementations where the accumulator determines the aggregate reward by λ-weighted prediction, the lambda neural network processes an input to generate a lambda factor for the next planning step (step 209). For the first planning step, the lambda neural network receives as input the internal state representation generated by the state representation neural network, and for subsequent planning steps, the lambda neural network receives as input the internal state representation generated by the prediction neural network at the previous planning step. The lambda factor can be a scalar, a vector, or a matrix, and generally has the same dimensionality as the outcome. In some cases the values of the entries of the lambda factor are between 0 and 1. In some implementations, the lambda neural network includes a sigmoid non-linearity layer to cause the values of the entries of the lambda factor to lie in the range 0 to 1. In some implementations, the lambda neural network shares parameter values with the prediction neural network.

The system determines whether the current planning step is the terminal planning step (step 210). In some cases, the current planning step may be the terminal planning step if it is the last planning step of the pre-determined number of planning steps. In the λ-weighted prediction implementation, the current planning step may be the terminal planning step if the λ-factor for the current planning step is identically zero (i.e., the λ-factor is zero if it is a scalar, or every entry of the λ-factor is zero if it is a vector or matrix), as will be described further below. In response to determining that the current planning step is not the terminal planning step, the system advances to the next planning step, returns to step 206, and repeats the preceding steps. In response to determining that the current planning step is the terminal planning step, the accumulator determines the aggregate reward (step 212).

In some implementations, the accumulator determines the aggregate reward by k-step prediction, where k is an integer between 1 and K, where K is the total number of planning steps. In these implementations, the accumulator generates the aggregate reward by combining the predicted reward and the predicted discount factor for each of the first k planning steps, and the value prediction of the k-th planning step, to determine the k-step return as output. Specifically, the accumulator determines the k-step return as:

g _(k) =r ₁+γ₁(r ₂+γ₂( . . . +γ_(k−1)(r _(k)+γ_(k)ν_(k)) . . . ))

where g_(k) is the k-step return, r_(i) is the reward of planning step i, γ_(i) is the discount factor of planning step i, and ν_(k) is the value prediction of planning step k.

In some other implementations, the accumulator determines the aggregate reward by λ-weighted prediction. In these implementations, the accumulator determines the k-step return for each planning step k and combines them according to weights defined by the lambda factors to determine the λ-weighted return as output. Specifically, the accumulator may determine the λ-weighted return as:

${g_{\lambda} = {\sum\limits_{k = 0}^{K}{w_{k}g_{k}}}},{{{where}\mspace{14mu} w_{k}} = \left\{ \begin{matrix} {{\left( {1 - \lambda_{k}} \right){\prod\limits_{j = 0}^{k - 1}\; {\lambda_{j}\mspace{14mu} {if}\mspace{14mu} k}}} < K} \\ {{\prod\limits_{j = 0}^{k - 1}\; {\lambda_{j}\mspace{14mu} {if}\mspace{14mu} k}} < K} \end{matrix} \right.}$

where g_(λ) is the λ-weighted return, λ_(k) is the λ-factor for the k-th planning step, w_(k) is a weight factor, 1 is the identity matrix, i.e. a matrix with ones on the diagonal and zero elsewhere, and g_(k) is the k-step return. The accumulator may also determine the λ-weighted return by a backward accumulation through intermediate steps g_(k,λ), where:

g _(k,λ)=(1−λ_(k))ν_(k)+λ_(k)(r _(k+1)γ_(k+1) g _(k+1,λ)) and g _(K,λ)=ν_(K),

and the λ-weighted return g_(λ) is determined as g_(0λ).

The system may compute the λ-weighted return g_(λ) based on a sequence of consecutive planning steps that does not include all K planning steps. For example, in the example formulation of g_(λ) previously provided, if λ_(k)=0 for a planning step k, then g_(λ) is determined based on the k-step returns of the first k planning steps and not the subsequent planning steps, since the weights w_(n) are zero for n>k. Therefore the system determines the aggregate reward based on an adaptive number of planning steps depending on the internal state representation and learning dynamics of the system.

FIG. 3 is a flow diagram of an example process 300 for training a predictron system. For convenience, the process 300 will be described as being performed by an engine including one or more computers located in one or more locations. For example, a training engine, e.g. the training engine 130 of FIG. 1, appropriately programmed in accordance with this specification, can perform the process 300.

The engine receives one or more observations of the environment being interacted with by an agent and, in some cases, a corresponding outcome associated with the current state of the environment (step 302).

The engine provides the observations to the system, and the system determines an aggregate reward that is an estimate of the outcome. An example process for determining the aggregate reward is described with reference to FIG. 2.

The engine determines gradients based on a loss function and backpropagates the gradients to jointly update the values of the sets of parameters of the neural networks of the system, i.e. the value prediction neural network, the state representation neural network, the prediction neural network, and in λ-weighted prediction implementations, the lambda neural network. The loss function may be a supervised loss function, i.e. a loss function that depends on the outcome corresponding to the observations provided as input and processed by the system, an unsupervised loss function, i.e. a loss function does not depend on the outcome, or a combination of supervised and unsupervised loss terms.

In the k-step prediction implementation, a supervised loss function may be given by:

|g−g_(k)|₂ ²,

where g is the outcome. As another example, in the λ-weighted prediction implementation, the supervised loss function used to backpropagate gradients into the lambda neural network may be given by:

|g−g_(λ)|₂ ²,

while the supervised loss function used to backpropagate gradients into the value prediction neural network, the state representation neural network, and the prediction neural network may be given by:

${\sum\limits_{k = 0}^{K}{{g - g_{k}}}_{2}^{2}},$

or by:

Σ_(k=0) ^(K) w _(k) |g−g _(k)|₂ ²,

In the λ-weighted prediction implementation, the unsupervised loss function may be given by:

${\sum\limits_{k = 0}^{K}{{g_{\lambda} - g_{k}}}_{2}^{2}},$

where g_(λ) is considered fixed, and gradients are backpropagated to make each k-step return g_(k) more similar to g_(λ), but not vice-versa. Backpropagating gradients based on the unsupervised loss function decreases the difference between the k-step returns and the λ-weighted return, making the k-step returns self-consistent and thereby increasing robustness of the system. Furthermore, since the unsupervised loss function does not depend on the outcome corresponding to the observations provided as input and processed by the system, the engine may train the system by backpropagating gradients based on the unsupervised loss function for sequences of observations where the corresponding outcome is not known.

For training observations where the corresponding outcome is known, the engine may update the values of the sets of parameters of the neural networks of the system based on a loss function that combines both a supervised loss term and an unsupervised loss term. For example, the loss function may be a weighted linear combination of the supervised loss term and the unsupervised loss term.

This specification uses the term “configured” in connection with systems and computer program components. For a system of one or more computers to be configured to perform particular operations or actions means that the system has installed on it software, firmware, hardware, or a combination of them that in operation cause the system to perform the operations or actions. For one or more computer programs to be configured to perform particular operations or actions means that the one or more programs include instructions that, when executed by data processing apparatus, cause the apparatus to perform the operations or actions.

Embodiments of the subject matter and the functional operations described in this specification can be implemented in digital electronic circuitry, in tangibly-embodied computer software or firmware, in computer hardware, including the structures disclosed in this specification and their structural equivalents, or in combinations of one or more of them. Embodiments of the subject matter described in this specification can be implemented as one or more computer programs, i.e., one or more modules of computer program instructions encoded on a tangible non-transitory storage medium for execution by, or to control the operation of, data processing apparatus. The computer storage medium can be a machine-readable storage device, a machine-readable storage substrate, a random or serial access memory device, or a combination of one or more of them. Alternatively or in addition, the program instructions can be encoded on an artificially-generated propagated signal, e.g., a machine-generated electrical, optical, or electromagnetic signal, that is generated to encode information for transmission to suitable receiver apparatus for execution by a data processing apparatus.

The term “data processing apparatus” refers to data processing hardware and encompasses all kinds of apparatus, devices, and machines for processing data, including by way of example a programmable processor, a computer, or multiple processors or computers. The apparatus can also be, or further include, special purpose logic circuitry, e.g., an FPGA (field programmable gate array) or an ASIC (application-specific integrated circuit). The apparatus can optionally include, in addition to hardware, code that creates an execution environment for computer programs, e.g., code that constitutes processor firmware, a protocol stack, a database management system, an operating system, or a combination of one or more of them.

A computer program, which may also be referred to or described as a program, software, a software application, an app, a module, a software module, a script, or code, can be written in any form of programming language, including compiled or interpreted languages, or declarative or procedural languages; and it can be deployed in any form, including as a stand-alone program or as a module, component, subroutine, or other unit suitable for use in a computing environment. A program may, but need not, correspond to a file in a file system. A program can be stored in a portion of a file that holds other programs or data, e.g., one or more scripts stored in a markup language document, in a single file dedicated to the program in question, or in multiple coordinated files, e.g., files that store one or more modules, sub-programs, or portions of code. A computer program can be deployed to be executed on one computer or on multiple computers that are located at one site or distributed across multiple sites and interconnected by a data communication network.

In this specification the term “engine” is used broadly to refer to a software-based system, subsystem, or process that is programmed to perform one or more specific functions. Generally, an engine will be implemented as one or more software modules or components, installed on one or more computers in one or more locations. In some cases, one or more computers will be dedicated to a particular engine; in other cases, multiple engines can be installed and running on the same computer or computers.

The processes and logic flows described in this specification can be performed by one or more programmable computers executing one or more computer programs to perform functions by operating on input data and generating output. The processes and logic flows can also be performed by special purpose logic circuitry, e.g., an FPGA or an ASIC, or by a combination of special purpose logic circuitry and one or more programmed computers.

Computers suitable for the execution of a computer program can be based on general or special purpose microprocessors or both, or any other kind of central processing unit. Generally, a central processing unit will receive instructions and data from a read-only memory or a random access memory or both. The essential elements of a computer are a central processing unit for performing or executing instructions and one or more memory devices for storing instructions and data. The central processing unit and the memory can be supplemented by, or incorporated in, special purpose logic circuitry. Generally, a computer will also include, or be operatively coupled to receive data from or transfer data to, or both, one or more mass storage devices for storing data, e.g., magnetic, magneto-optical disks, or optical disks. However, a computer need not have such devices. Moreover, a computer can be embedded in another device, e.g., a mobile telephone, a personal digital assistant (PDA), a mobile audio or video player, a game console, a Global Positioning System (GPS) receiver, or a portable storage device, e.g., a universal serial bus (USB) flash drive, to name just a few.

Computer-readable media suitable for storing computer program instructions and data include all forms of non-volatile memory, media and memory devices, including by way of example semiconductor memory devices, e.g., EPROM, EEPROM, and flash memory devices; magnetic disks, e.g., internal hard disks or removable disks; magneto-optical disks; and CD-ROM and DVD-ROM disks.

To provide for interaction with a user, embodiments of the subject matter described in this specification can be implemented on a computer having a display device, e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor, for displaying information to the user and a keyboard and a pointing device, e.g., a mouse or a trackball, by which the user can provide input to the computer. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback, e.g., visual feedback, auditory feedback, or tactile feedback; and input from the user can be received in any form, including acoustic, speech, or tactile input. In addition, a computer can interact with a user by sending documents to and receiving documents from a device that is used by the user; for example, by sending web pages to a web browser on a user's device in response to requests received from the web browser. Also, a computer can interact with a user by sending text messages or other forms of message to a personal device, e.g., a smartphone that is running a messaging application, and receiving responsive messages from the user in return.

Data processing apparatus for implementing machine learning models can also include, for example, special-purpose hardware accelerator units for processing common and compute-intensive parts of machine learning training or production, i.e., inference, workloads.

Machine learning models can be implemented and deployed using a machine learning framework, e.g., a TensorFlow framework, a Microsoft Cognitive Toolkit framework, an Apache Singa framework, or an Apache MXNet framework.

Embodiments of the subject matter described in this specification can be implemented in a computing system that includes a back-end component, e.g., as a data server, or that includes a middleware component, e.g., an application server, or that includes a front-end component, e.g., a client computer having a graphical user interface, a web browser, or an app through which a user can interact with an implementation of the subject matter described in this specification, or any combination of one or more such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication, e.g., a communication network. Examples of communication networks include a local area network (LAN) and a wide area network (WAN), e.g., the Internet.

The computing system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. In some embodiments, a server transmits data, e.g., an HTML page, to a user device, e.g., for purposes of displaying data to and receiving user input from a user interacting with the device, which acts as a client. Data generated at the user device, e.g., a result of the user interaction, can be received at the server from the device.

While this specification contains many specific implementation details, these should not be construed as limitations on the scope of any invention or on the scope of what may be claimed, but rather as descriptions of features that may be specific to particular embodiments of particular inventions. Certain features that are described in this specification in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination. Moreover, although features may be described above as acting in certain combinations and even initially be claimed as such, one or more features from a claimed combination can in some cases be excised from the combination, and the claimed combination may be directed to a subcombination or variation of a subcombination.

Similarly, while operations are depicted in the drawings and recited in the claims in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order, or that all illustrated operations be performed, to achieve desirable results. In certain circumstances, multitasking and parallel processing may be advantageous. Moreover, the separation of various system modules and components in the embodiments described above should not be understood as requiring such separation in all embodiments, and it should be understood that the described program components and systems can generally be integrated together in a single software product or packaged into multiple software products.

Particular embodiments of the subject matter have been described. Other embodiments are within the scope of the following claims. For example, the actions recited in the claims can be performed in a different order and still achieve desirable results. As one example, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some cases, multitasking and parallel processing may be advantageous. 

What is claimed is:
 1. A system implemented by one or more computers, the system comprising: a state representation neural network that is configured to: receive one or more observations characterizing states of an environment being interacted with by an agent, and process the one or more observations to generate an internal state representation of a current environment state; a prediction neural network that is configured to, for each of a plurality of internal time steps: receive an internal state representation for the internal time step; and process the internal state representation for the internal time step to generate: an internal state representation for a next internal time step, and a predicted reward for the next internal time step; a value prediction neural network that is configured to, for each of the plurality of internal time steps: receive the internal state representation for the internal time step, and process the internal state representation for the internal time step to generate a value prediction that is an estimate of a future cumulative discounted reward from a next internal time step onwards; and a subsystem that is configured to: receive one or more observations characterizing states of the environment; provide the one or more observations as input to the state representation neural network to generate an internal state representation of the current environment state; for each of the plurality of internal time steps: generate, using the prediction neural network and the value prediction neural network and from the internal state representation for the internal time step: an internal state representation for the next internal time step, a predicted reward for the next internal time step, and a value prediction; and determine an aggregate reward from the predicted rewards and the value predictions for the internal time steps.
 2. The system of claim 1, wherein the subsystem is further configured to: provide the aggregate reward as an estimate of a reward resulting from the environment being in the current state.
 3. The system of claim 1, wherein the prediction neural network is further configured to generate a predicted discount factor for the next internal time step, and wherein the subsystem is configured to use the predicted discount factors for the internal time steps in determining the aggregate reward.
 4. The system of claim 3, wherein the system further comprises: a lambda neural network that is configured to, for each of the internal time steps, process an internal state representation for a current internal time step to generate a lambda factor for a next internal time step, and wherein the subsystem is configured to determine a k-step return for the internal time steps and use the lambda factors to determine weights for the k-step returns in determining the aggregate reward, wherein the k-step return is determined by combining the predicted return and the predicted discount factor for each of the first k internal time steps and the value prediction for the k-th internal time step.
 5. The system of claim 1, wherein the state representation neural network comprises a recurrent neural network.
 6. The system of claim 1, wherein the state representation neural network comprises a feedforward neural network.
 7. The system of claim 1, wherein the prediction neural network comprises a recurrent neural network.
 8. The system of claim 1, wherein the prediction neural network comprises a feedforward neural network that has different parameter values at each of the plurality of time steps.
 9. One or more non-transitory computer storage media storing instructions that when executed by one or more computers cause the one or more computers to implement: a state representation neural network that is configured to: receive one or more observations characterizing states of an environment being interacted with by an agent, and process the one or more observations to generate an internal state representation of a current environment state; a prediction neural network that is configured to, for each of a plurality of internal time steps: receive an internal state representation for the internal time step; and process the internal state representation for the internal time step to generate: an internal state representation for a next internal time step, and a predicted reward for the next internal time step; a value prediction neural network that is configured to, for each of the plurality of internal time steps: receive the internal state representation for the internal time step, and process the internal state representation for the internal time step to generate a value prediction that is an estimate of a future cumulative discounted reward from a next internal time step onwards; and a subsystem that is configured to: receive one or more observations characterizing states of the environment; provide the one or more observations as input to the state representation neural network to generate an internal state representation of the current environment state; for each of the plurality of internal time steps: generate, using the prediction neural network and the value prediction neural network and from the internal state representation for the internal time step: an internal state representation for the next internal time step, a predicted reward for the next internal time step, and a value prediction; and determine an aggregate reward from the predicted rewards and the value predictions for the internal time steps.
 10. The non-transitory computer storage media of claim 9, wherein the subsystem is further configured to: provide the aggregate reward as an estimate of a reward resulting from the environment being in the current state.
 11. The non-transitory computer storage media of claim 9, wherein the prediction neural network is further configured to generate a predicted discount factor for the next internal time step, and wherein the subsystem is configured to use the predicted discount factors for the internal time steps in determining the aggregate reward.
 12. The non-transitory computer storage media of claim 11, wherein the instructions further cause the one or more computers to implement: a lambda neural network that is configured to, for each of the internal time steps, process an internal state representation for a current internal time step to generate a lambda factor for a next internal time step, and wherein the subsystem is configured to determine a k-step return for the internal time steps and use the lambda factors to determine weights for the k-step returns in determining the aggregate reward, wherein the k-step return is determined by combining the predicted return and the predicted discount factor for each of the first k internal time steps and the value prediction for the k-th internal time step.
 13. The non-transitory computer storage media of claim 9, wherein the state representation neural network comprises a recurrent neural network.
 14. The non-transitory computer storage media of claim 9, wherein the state representation neural network comprises a feedforward neural network.
 15. The non-transitory computer storage media of claim 9, wherein the prediction neural network comprises a recurrent neural network.
 16. The non-transitory computer storage media of claim 9, wherein the prediction neural network comprises a feedforward neural network that has different parameter values at each of the plurality of time steps.
 17. A method performed by one or more data processing apparatus, the method comprising: receiving one or more observations characterizing states of an environment being interacted with by an agent; providing the one or more observations as input to a state representation neural network, wherein the state representation neural network is configured to: receive the one or more observations, and process the one or more observations to generate an internal state representation of a current environment state; for each of a plurality of internal time steps: generating, using a prediction neural network and a value prediction neural network and from an internal state representation for the internal time step: an internal state representation for the next internal time step, a predicted reward for the next internal time step, and a value prediction; wherein the prediction neural network is configured to, for each of the plurality of internal time steps: receive the internal state representation for the internal time step; and process the internal state representation for the internal time step to generate: an internal state representation for a next internal time step, and a predicted reward for the next internal time step; wherein the value prediction neural network is configured to, for each of the plurality of internal time steps: receive the internal state representation for the internal time step, and process the internal state representation for the internal time step to generate a value prediction that is an estimate of a future cumulative discounted reward from a next internal time step onwards; and determining an aggregate reward from the predicted rewards and the value predictions for the internal time steps.
 18. The method of claim 17, further comprising: providing the aggregate reward as an estimate of a reward resulting from the environment being in the current state.
 19. The method of claim 17, wherein the prediction neural network is further configured to generate a predicted discount factor for the next internal time step, and further comprising using the predicted discount factors for the internal time steps in determining the aggregate reward.
 20. The method of claim 17, wherein the state representation neural network comprises a recurrent neural network. 